<template>
  <div class="public_main">
    <div class="crumbs">
      <el-breadcrumb separator="/">
        <el-breadcrumb-item>{{$t('newcrumbs.crumbsEle')}}</el-breadcrumb-item>
        <el-breadcrumb-item>{{$t('newcrumbs.crumbsTwo')}}</el-breadcrumb-item>
        <el-breadcrumb-item>{{$t('riskManage.crumbsFour')}}</el-breadcrumb-item>
      </el-breadcrumb>
    </div>
    
    <!-- -------------搜索查询栏------------------------ -->
      <search 
			:searchData="searchData" 
			@search="search" 
			@putExcel="putExcel" 
			:searchRight="true"
			:outputRight="$store.state.common.permiss.artificialtrialsta.includes('export')"
    ></search>
    
    <!-- -------------表单显示栏------------------------ -->
    <div class="table" v-if="true">
      <template>
        <el-table size="small" :data="tableData" :summary-method="getSummaries"
          show-summary>
          <el-table-column align="center" prop="createTime" :label="$t('public.no33')" width="140">
            <template slot-scope="scope">
              <span v-if="scope.row.createTime!=''">{{(scope.row.createTime).slice(0,10)}}</span>
              <span v-else>{{$store.state.common.nullData}}</span>
            </template>
          </el-table-column>
          <el-table-column align="center" prop="adminName" :label="$t('public.no32')" >
          </el-table-column>
          <el-table-column align="center" prop="groupName" :label="$t('new.no18')" >
          </el-table-column>
          <el-table-column align="center" prop="leaderName" :label="$t('new.no19')" >
          </el-table-column>
          <el-table-column align="center" prop="approveType" :label="$t('loanMoneyDetail.opeType2')" >
            <template slot-scope="scope">
              <span>{{$t($store.getters.auditType(scope.row.approveType))}}</span>
            </template>
          </el-table-column>
          <el-table-column align="center" prop="reviewCount" :label="$t('riskManage.reviewCount')" >
          </el-table-column>
          <el-table-column align="center" prop="successCount" :label="$t('riskManage.successCount')" >
          </el-table-column>
          <el-table-column align="center" prop="failCount" :label="$t('riskManage.failCount')" >
          </el-table-column>
          <el-table-column align="center" prop="successRate" :label="$t('riskManage.successRate')" >
            <template slot-scope="scope">
              <span>{{$store.getters.twoPoint(scope.row.successRate)}}</span>
            </template>
          </el-table-column>
          <el-table-column align="center" prop="reviewSuccessCount" :label="$t('new.no6')" >
          </el-table-column>
          <el-table-column align="center" prop="reviewSuccessRate" :label="$t('new.no7')" >
            <template slot-scope="scope">
              <span>{{$store.getters.twoPoint(scope.row.reviewSuccessRate)}}</span>
            </template>
          </el-table-column>
            <el-table-column align="center" prop="loanCount" :label="$t('channelManage.no7')" >
            </el-table-column>
            <el-table-column align="center" prop="maturityCount" :label="$t('add.no87')" >
            </el-table-column>
            <el-table-column align="center" prop="overdueCount" :label="$t('channelManage.no11')" >
            </el-table-column>
            <el-table-column align="center" prop="firstOverdueRate" :label="$t('add.no16')" >
              <template slot-scope="scope">
                <span>{{$store.getters.twoPoint(scope.row.firstOverdueRate)}}</span>
              </template>
            </el-table-column>
        </el-table>
      </template>
    </div>

    <!-- ------------  分页显示栏  ------------------------ -->
    <el-row type="flex" justify="end">
      <div class="pages" >
        <el-pagination
          @current-change="handleCurrentChange"
          :current-page="pagination.current"
          layout="sizes, prev, pager, next, total,->"
          :page-sizes="pagination.pageSizeOptions"
          :page-size="pagination.pageSize"
          @size-change="handleSizeChange"
          :total="pagination.total">
        </el-pagination>
      </div>
    </el-row>
    <div class="foot"></div>

  </div>
</template>
<script>
import putExcel from 'src/mixins/putExcel.js';//导出excel
import getGroupName from 'src/mixins/getGroupName.js';//获取组名下拉
import getGroupMem from 'src/mixins/getGroupMem.js';//获取审核员下拉
import getGroupLeader from 'src/mixins/getGroupLeader.js';//获取组组长下拉
export default {
  name: 'peopleFirstAuditTotal',
  mixins:[putExcel,getGroupName,getGroupMem,getGroupLeader],
  data () {
    const searchData=[
      {
        type: 'rangePicker',
        label: 'riskManage.selectTime',
        attr: 'searchTime',
        value: [],
      },
      {
        type: 'select',
        attr: 'adminName',
        label: 'public.no32',
        option: [],
        value: '',
      },
      {
        type: 'select',
        attr: 'groupId',
        label: 'new.no20',
        option: [],
        value: '',
      },{
        type: 'select',
        attr: 'leaderId',
        label: 'new.no21',
        option: [],
        value: '',
      }
    ]
    return {
      pagination: {
        pageSize: global.config.pageSize,
        pageSizeOptions: global.config.pageSizeOptions,
        current: 1,
        total: 0,
      },
      searchData:searchData,
      flag: true,
      formInline: {// 用户查询信息数据对应字段
        adminName: "",
        groupId: "",
        leaderId: "",
        approveTimeBegin: "",
        approveTimeEnd: ""
      },
      options1: [], // 组名下拉选框信息
      options3: [], // 组长下拉选框信息
      tableData: [],// 列表数据模拟
      tableData1: [],// 列表数据模拟
      putExcelUrl:this.$action.risk_approveFirExport
    }
  },
  methods: {
    handleSizeChange (val) {// 每页条数变化时操作
      this.pagination.pageSize = val;
      this.getTableData();
    },
    handleCurrentChange (val) { // 分页按钮点击操作
      this.pagination.current = val;
      this.getTableData();
    },
    search(search) { // 搜索
        this.formInline=search;
        this.formInline.approveTimeBegin=search.searchTime[0];
        this.formInline.approveTimeEnd=search.searchTime[1];
        if (this.flag) {
          this.flag = false;
          this.pagination.current = 1;
          this.getTableData();
        }
    },
    getTableData () { // 获取人工审核统计列表
      let option = {
        pageNum:this.pagination.current,
        pageSize:this.pagination.pageSize,
        param: {
          ...this.formInline
        }       
      }
      this.$axios.post(this.$action.risk_approveFirStatis, option).then(res => {
        this.flag = true;
        if (res.code == 200) {
          this.tableData = res.data.pageDTO.list;
          this.tableData1 = res.data.orderReviewReportDO;
          this.pagination.total = res.data.pageDTO.total;
        }
      })
    },
    getSummaries() {// 总和
      const sums = [
        this.$t('public.addTotal'),
        '-',
        '-',
        '-',
        '-',
        this.tableData1.reviewCount,
        this.tableData1.successCount,
        this.tableData1.failCount,
        this.$store.getters.twoPoint(this.tableData1.successRateCount),
        this.tableData1.reviewSuccessCount,
        this.$store.getters.twoPoint(this.tableData1.reviewSuccessRateCount),
        this.tableData1.loanCount,
        this.tableData1.maturityCount,
        this.tableData1.overdueCount,
        this.$store.getters.twoPoint(this.tableData1.firstOverdueRate),
      ];
      return sums;
    }
  },
  mounted () {
     this.getGroupMem(2).then(arr=>{
      this.searchData[1].option=arr;
    })
    this.getGroupName(2).then(arr=>{
      this.searchData[2].option=arr;
    })
    this.getGroupLeader(2).then(arr=>{
      this.searchData[3].option=arr;
    })
    this.getTableData();// 获取人工审核统计列表
  }
}
</script>
<style scoped lang="scss">

</style>
